package com.xiaomi.shwx.entity.vo;

import lombok.Data;

import java.io.Serializable;

/**
 * @description:
 * @author: Lei
 * @create: 2024-05-15 12:38
 **/

@Data
public class UserLoginVO implements Serializable {

    private static final long serialVersionUID = 1L;
    /**
     * 用户 id
     */
    private Long id;

    /**
     * 用户昵称
     */
    private String name;

    /**
     * 用户头像
     */
    private String avtar;

    /**
     * 用户简介
     */
    private String profile;

    /**
     * 用户角色：user/engineer/admin
     */
    private String role;

    /**
     * 用户登录/注册失败时，设置 id 为 -1进行标识
     */
    public UserLoginVO fail() {
        this.setId(-1L);
        return this;
    }

    /**
     * 检查是否登录/注册失败
     * @return
     */
    public boolean checkFail() {
        return this.getId() == -1L;
    }
}
